package framework.service.impl;

import framework.dao.UserDao;
import framework.dao.imp.UserDaoImp;
import framework.pojo.User;
import framework.service.UserService;

public class UserServiceImp implements UserService {

    private UserDao userDao = new UserDaoImp();

    @Override
    public void registUser(User user) {

        userDao.saveUser(user);

    }

    @Override
    public User login(User user) {
        return userDao.queryUserByUsernameAndPassword(user.getUsername(), user.getPassword());
    }

    @Override
    public boolean existsUsername(String username) {
        //没查到表示可用
        if(userDao.queryUserByUsername(username)==null)
            return false;
        return true;
    }
}
